package com.hoperun.controller.api;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hoperun.bean.AdminManager;
import com.hoperun.framework.models.DataView;
import com.hoperun.service.IAdminManagerSV;
import com.hoperun.utils.XHZUtils;

@Controller
@RequestMapping("/api/user")
public class UserController {

	@Resource
	private IAdminManagerSV managerSV;

	@RequestMapping("/register")
	@ResponseBody
	public DataView register(String account, String pwd, Integer type) {
		DataView dataView = new DataView();
//		String account = postParams.get("account");
//    	String pwd = postParams.get("pwd");
//    	String type = postParams.get("type");
//    	String sdkpwd = Tools.getRandomStr(8);
    	account = account.toLowerCase();
    	String sdkpwd = XHZUtils.getRandomStr(8) ;
    	AdminManager manager = new AdminManager() ;
    	
    	manager.setAccout(account) ;
    	manager.setPassword(pwd) ;
    	manager.setUserType(type) ;
    	manager.setSdkPwd(sdkpwd) ;
		return dataView;
	}
}
